Skip to content

feat: add pipeline-level endOfStream() method#21

Merged
repugraf merged 3 commits into
repugraf:mainfrom
MantaLabsAI:feature/pipeline-eos
Jun 17, 2026
Merged

feat: add pipeline-level endOfStream() method#21
repugraf merged 3 commits into
repugraf:mainfrom
MantaLabsAI:feature/pipeline-eos

Conversation

@IrishBAM

@IrishBAM IrishBAM commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Add pipeline-level endOfStream() method

Send a GStreamer EOS event directly to the pipeline element, enabling clean stream termination regardless of source type (hardware cameras, network streams, test sources).

Changes

  • Native layer — Add end_of_stream method to the Pipeline C++ class, state-gated so it only sends when the pipeline is PLAYING or PAUSED
  • TypeScript API — Expose endOfStream(): boolean on the Pipeline interface as an enumerable instance property
  • Tests — Integration tests covering state dispatch, bus propagation, repeated calls, and post-stop behavior
  • Exampleexamples/pipeline-eos.mjs demonstrating usage
  • Docs — README updated with API reference and usage example
  • Package — Renamed to @mantalabs/gst-kit, bumped to 0.2.8-alpha1

API

const pipeline = new Pipeline("videotestsrc ! fakesink");
await pipeline.play();

const sent = pipeline.endOfStream(); // true if EOS event was sent
await pipeline.stop();

Returns true when the pipeline is in a state that accepts events (PLAYING/PAUSED), false otherwise (NULL/READY/stopped).

Testing

  • 7 integration tests validating state gating, synchronous return type, bus message propagation, idempotent repeated calls, and post-stop behavior

@repugraf

Copy link
Copy Markdown
Owner

Thank's a lot for contribution. Didn't have a time to take a look it yet. Will do ASAP!

@repugraf

Copy link
Copy Markdown
Owner

The CI issue is unrelated to the feature. I'm gonna fix it in a separate PR so this branch could be rebased from it.

@repugraf

Copy link
Copy Markdown
Owner

The fix should be done here: #22

@repugraf

repugraf commented Jun 16, 2026

Copy link
Copy Markdown
Owner

@IrishBAM turns out the fix was easier than anticipated. We've just needed to update node-gyp version. Please rebase from main branch and revert all unrelated CI fix attempts

@repugraf repugraf self-requested a review June 16, 2026 10:53
IrishBAM added 2 commits June 16, 2026 10:17
Send a GStreamer EOS event directly to the pipeline element, enabling
clean stream termination regardless of source type (hardware cameras,
network streams, test sources).

- Add end_of_stream native method to Pipeline C++ class
  (state-gated: only sends when PLAYING or PAUSED)
- Register endOfStream as enumerable instance property
- Add endOfStream(): boolean to TypeScript Pipeline interface
- Add integration tests (state dispatch, bus propagation, repeated calls)
- Add examples/pipeline-eos.mjs
- Update README with API reference and usage example
…ndows) to account for CI and Bun runtime scheduling variance.
@IrishBAM IrishBAM force-pushed the feature/pipeline-eos branch from 6c59d0f to e5f1082 Compare June 16, 2026 17:20

@repugraf repugraf left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments

Comment thread src/ts/index.ts Outdated
Comment thread src/ts/pipeline-eos.test.ts Outdated
Comment thread examples/pipeline-eos.mjs

@repugraf repugraf left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'll merge this tomorrow and publish a new npm package version with this feature.

@repugraf repugraf merged commit 591542b into repugraf:main Jun 17, 2026
29 of 30 checks passed
@repugraf

Copy link
Copy Markdown
Owner

@IrishBAM the feature have been published on npm in version 0.2.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants